package com.probiz.estore.content.service.impl;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.probiz.estore.common.model.content.AdPositionType;
import com.probiz.estore.content.dao.AdPositionTypeDao;
import com.probiz.estore.core.service.impl.GenericManagerImpl;

public class AdPositionTypeManagerImpl extends GenericManagerImpl<AdPositionType> implements com.probiz.estore.content.service.AdPositionTypeManager {

	AdPositionTypeDao adPositionTypeDao=null;
	
	public void setAdPositionTypeDao(AdPositionTypeDao adPositionTypeDao) {
		this.adPositionTypeDao = adPositionTypeDao;
	}

	@Override
	protected void initManager() {
		this.dao=adPositionTypeDao;
		
	}
	@Override
	protected void preDelete(AdPositionType entity) {
		
	}

	@Override
	protected void preSave(AdPositionType entity) {
		
	}
	

	public Map getAll4Front() {
		Map result = new HashMap();
		List<AdPositionType> temps = this.adPositionTypeDao.listAll();
		for(Iterator it = temps.iterator();it.hasNext();){
			AdPositionType adPositionType =(AdPositionType)it.next();
			result.put(adPositionType.getPositionCode(),adPositionType);
		}
		return result;
	}

	public AdPositionType getAdPositionTypeByCode(String positionCode) {
		return this.adPositionTypeDao.getAdPositionTypeByCode(positionCode);
	}

	public boolean isExistPositionCode(String positionCode, Integer positionId) {
		return adPositionTypeDao.isExistPositionCode(positionCode, positionId);
	}

	
}
